const {
    Keypair,
    Transaction,
    SystemProgram,
    LAMPORTS_PER_SOL,
    TransactionMessage,
    TransactionInstruction
} = require("@solana/web3.js");
const config = require('./config');

const SolChain = require('./SolChain');

const run = async () => {
    let solChain = new SolChain(config.localNode);

    let hello_program_keypar = require('../simple-hello_world/target/deploy/simple_hello_world-keypair.json');
    let secretKey = Uint8Array.from(hello_program_keypar);
    let programKeypair = Keypair.fromSecretKey(secretKey);

    let programID = programKeypair.publicKey;
    console.log('programID: ', programID);

    let txs = await solChain.getSignaturesForAddress(programID,config.signatures[3]);
    for(let tx of txs) {
        console.log('tx: ', tx);

        //let txSignature = tx.signature;
        //let txDetails = await solChain.getTransaction(txSignature);
        //console.log('txDetails: ', txDetails);
    }
}

run();